package controller

import (
	"context"

	"github.com/tiger1103/gfast/v3/api/v1/wxappapi"
	"github.com/tiger1103/gfast/v3/internal/app/app/model"
	"github.com/tiger1103/gfast/v3/internal/app/app/service"
)

var NewsController = new(newsController)

type newsController struct{}

func (c *newsController) Get(ctx context.Context, req *wxappapi.GetNewsReq) (res *model.AppNewsInfoRes, err error) {
	res = new(model.AppNewsInfoRes)
	res, err = service.AppNews().GetById(ctx, req.Id)
	return
}

func (c *newsController) List(ctx context.Context, req *wxappapi.ListNewsReq) (res *model.AppNewsSearchRes, err error) {
	res = new(model.AppNewsSearchRes)
	res, err = service.AppNews().List(ctx, &req.AppNewsSearchReq)
	return
}
